// 父类:公共属性和方法
function Person(name, age, friends) {
  // stu.name = nme
  this.name = name
  this.age = age
  this.friends = friends
}
Person.prototype.eating = function () {
  console.log(this.name + 'eating');
}



// 子类:特有属性和方法
function Student(name, age, friends, sno) {
  Person.call(this, name, age, friends)
  this.sno = sno
}

// 直接将父类的原型赋值给子类,作为子类的原型
Student.prototype = Person.prototype

// 这样这个原型被加到Person的原型里面了 你其他方法继承也会有这个方法了!!!!!!!!!!!!!!!
Student.prototype.studying = function () {
  console.log(this.name + 'studying');
}

var stu = new Student('why', 19, ['kibe'], 111)
console.log(stu);
stu.eating()